package org.fly.jingwei.ext.task;

import org.apache.ibatis.session.defaults.DefaultSqlSessionFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * @author leo.jie (weixiao.me@aliyun.com)
 * @version 1.0
 * @organization bigdata
 * @website https://www.jielongping.com
 * @date 2020/5/30 11:07 上午
 * @since 1.0
 */
@Component("mybatisDaoSupport")
public class MybatisDaoSupport implements ApplicationContextAware {
    public static DefaultSqlSessionFactory sessionFactory;

    @Override
    public void setApplicationContext(ApplicationContext context) throws BeansException {
        //BasicDataSource dataSource = (BasicDataSource) context.getBean("dataSource");
        sessionFactory = (DefaultSqlSessionFactory) context.getBean("sqlSessionFactory");
    }
}
